﻿using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Von.Web.Components
{
    public class ScreenLabel : Models.ScreenComponentBase
    {
        public override string ComponentName { get => "ScreenLabel"; }
        public override string Sketch { get => "/Images/ScreenLabel.png"; }
        private JObject _ParamSchema = JObject.Parse("{'字体':'text','字号':'number','字色':'color','背景':'text'}");
        public override JObject ParamSchema { get => _ParamSchema; }
        public override string Author { get => "jamesvon"; }
        public override string Version { get => "1.0.0.1"; }
        public override DateTime Publishedate { get => DateTime.Parse("2022/01/16"); }
        public override string Copyright { get => "Copyright by jamesvon."; }
        public override int Width => 254;
        public override int Height => 90;
        public override string Run(Models.ScreenItemModel item)
        {
            //<div id="EClock" style="background:url('./js实现表盘指针/digitDial2.png')no-repeat !important; padding:50px 8px;font-family: 'Share Tech Mono', monospace;background-color: #000;color: #FFF;text-shadow: 0 0 20px #FFF, 0 0 20px rgba(10, 175, 230, 0);width:342px;height:97px;"></div>

            return "<div id='SCREEN_" + item.ID.ToString() + "' style='" + item.Style + @"'></div><script>addJavascriptFile('/js/ScreenComponent.js');
DigitClock('SCREEN_" + item.ID.ToString() + @"',{
lines:[{ dateFormat: 'yyyy年MM月dd日 w',style: 'font:20px MicrosoftYaHei Bold; letter-spacing: 0.1em; text-align:center;'},
{ dateFormat: 'hh:mm:ss',style: 'font:60px Helvetica Bold;letter-spacing: 0.05em; padding: 5px 0;text-align:center;'}]})</script>";
        }
    }
    public class ScreenClock : Models.ScreenComponentBase
    {
        public override string ComponentName { get => "表盘时钟"; }
        public override string Sketch { get => "/Images/CircleClock.png"; }
        private JObject _ParamSchema = JObject.Parse("{'表盘背景图':'text'}");
        public override JObject ParamSchema { get => _ParamSchema; }
        public override string Author { get => "jamesvon"; }
        public override string Version { get => "1.0.0.1"; }
        public override DateTime Publishedate { get => DateTime.Parse("2022/01/27"); }
        public override string Copyright { get => "Copyright by jamesvon."; }
        public override int Width => 300;
        public override int Height => 300;
        public override string Run(Models.ScreenItemModel item)
        {
            return "<div id='SCREEN_" + item.ID.ToString() + "' style='" + item.Style + ";background-image:url(./bailing.jpg);'></div>";
        }
    }
    public class ScreenDigitalClock : Models.ScreenComponentBase
    {
        public override string ComponentName { get => "数字时钟"; }
        public override string Sketch { get => "/Images/DigitalClock.png"; }
        private JObject _ParamSchema = JObject.Parse("{'样式':['时间','日期','时间日期','格式'],'格式':'text'}");
        public override JObject ParamSchema { get => _ParamSchema; }
        public override string Author { get => "jamesvon"; }
        public override string Version { get => "1.0.0.1"; }
        public override DateTime Publishedate { get => DateTime.Parse("2022/01/27"); }
        public override string Copyright { get => "Copyright by jamesvon."; }
        public override int Width => -254;  //负数表示不可更改尺寸值
        public override int Height => -90;  //负数表示不可更改尺寸值
        public override string Run(Models.ScreenItemModel item)
        {
            return "<div id='SCREEN_" + item.ID.ToString() + "' style='" + item.Style + ";background-image:url(./bailing.jpg);'></div>";
        }
    }
}
